from peewee import *
from app.db import db
from datetime import datetime

class Article(Model):
    id = AutoField(primary_key=True)  # 文章ID，自动递增
    title = CharField(max_length=100)  # 文章标题
    content = TextField()  # 文章内容
    created_at = DateTimeField(default=datetime.now)  # 创建时间，默认为当前时间
    updated_at = DateTimeField(default=datetime.now)  # 更新时间，默认为当前时间

    class Meta:
        database = db  # 指定数据库连接
        table_name = 'articles'  # 指定表名